import 'package:yundongjia_ble/yundongjia_ble.dart';

import '../device_data_context.dart';

mixin ActionMixin {
//停止
  void actionStop() {
    YundongjiaBle.instance
        .sendAdvertiseCommand(DeviceDataContext.instance.devcie.actionStop());
  }

//前进
  void actionForward() {
    YundongjiaBle.instance.sendAdvertiseCommand(
        DeviceDataContext.instance.devcie.actionForward());
  }

  //后退
  void actionBackward() {
    YundongjiaBle.instance.sendAdvertiseCommand(
        DeviceDataContext.instance.devcie.actionBackward());
  }

  //左转
  void actionLeft() {
    YundongjiaBle.instance
        .sendAdvertiseCommand(DeviceDataContext.instance.devcie.actionLeft());
  }

  //右转
  void actionRight() {
    YundongjiaBle.instance
        .sendAdvertiseCommand(DeviceDataContext.instance.devcie.actionRight());
  }

  //左转前进
  void actionForwardLeft() {
    YundongjiaBle.instance.sendAdvertiseCommand(
        DeviceDataContext.instance.devcie.actionForwardLeft());
  }

  //右转前进
  void actionForwardRight() {
    YundongjiaBle.instance.sendAdvertiseCommand(
        DeviceDataContext.instance.devcie.actionForwardRight());
  }

  //左转后退
  void actionBackwardLeft() {
    YundongjiaBle.instance.sendAdvertiseCommand(
        DeviceDataContext.instance.devcie.actionBackwardLeft());
  }

  //右转后退
  void actionBackwardRight() {
    YundongjiaBle.instance.sendAdvertiseCommand(
        DeviceDataContext.instance.devcie.actionBackwardRight());
  }

  void actionA({bool reverse = false}) {
    YundongjiaBle.instance.sendAdvertiseCommand(
        DeviceDataContext.instance.devcie.actionA(reverse));
  }

  void actionB({bool reverse = false}) {
    YundongjiaBle.instance.sendAdvertiseCommand(
        DeviceDataContext.instance.devcie.actionB(reverse));
  }

  void actionC({bool reverse = false}) {
    YundongjiaBle.instance.sendAdvertiseCommand(
        DeviceDataContext.instance.devcie.actionC(reverse));
  }

  void actionD({bool reverse = false}) {
    YundongjiaBle.instance.sendAdvertiseCommand(
        DeviceDataContext.instance.devcie.actionD(reverse));
  }
}
